package com.fanben100.util;

import java.io.*;

public class InputMasking {
	String getPassword(String initial) throws IOException {
		MaskingThread listeningthread = new MaskingThread(initial);
		Thread thread_instance = new Thread(listeningthread);
		String password = "";
		thread_instance.start();
		while (true) {
			char input = (char) System.in.read();
			listeningthread.stopMasking();
			if (input == '\r') {
				input = (char) System.in.read();
				if (input == '\n')
					break;
				else
					continue;
			} else if (input == '\n')
				break;
			else
				password += input;
		}
		return password;
	}
}